CXXFLAGS=-g -std=c++11

libmars.a: util.o mutex_lock.o condition.o thread.o thread_pool.o count_down_latch.o latch.o defer.o
	ar -r libmars.a util.o mutex_lock.o condition.o thread.o thread_pool.o count_down_latch.o latch.o defer.o

util.o:logger.h util.cc
	gcc ${CXXFLAGS} -o util.o -c util.cc

mutex_lock.o:logger.h mutex_lock.h mutex_lock.cc
	gcc ${CXXFLAGS} -o mutex_lock.o -c mutex_lock.cc

condition.o:logger.h condition.h condition.cc
	gcc ${CXXFLAGS} -o condition.o -c condition.cc

thread.o:logger.h thread.h thread.cc
	gcc ${CXXFLAGS} -o thread.o -c thread.cc

thread_pool.o:logger.h thread_pool.h thread_pool.cc
	gcc ${CXXFLAGS} -o thread_pool.o -c thread_pool.cc

count_down_latch.o:logger.h count_down_latch.h count_down_latch.cc
	gcc ${CXXFLAGS} -o count_down_latch.o -c count_down_latch.cc

latch.o:logger.h latch.h latch.cc
	gcc ${CXXFLAGS} -o latch.o -c latch.cc

defer.o:logger.h defer.h defer.cc
	gcc ${CXXFLAGS} -o defer.o -c defer.cc

clean:
	rm -rf *.o *.a

.PHONY:clean
